define(function(require, exports, module) {
	var ACEConstant=require('resources/template/common/ACEConstant.js');
	var DTDefault={
		dom:'<"row"<"col-sm-6"l><"col-sm-6"f><"col-sm-6"B>>t<"center"r><"row"<"col-sm-5"i><"col-sm-7"p>>',
		//processing:true,
		ordering:false,
		searchDelay: 2000,
		serverSide: true,
		buttons:{
			dom:{
				container: {
	                className:'btn-group'
	            }
			}
		},
		language:{
			"sProcessing": "处理中...",
		    "sInfoPostFix": "",
		    "sSearch": "搜索：",
		    "sUrl": "",
		    "sEmptyTable": "表中数据为空",
		    "sLoadingRecords": "载入中...",
		    "sInfoThousands": ",",
		    "oPaginate": {
		        "sFirst": "首页",
		        "sPrevious": "上页",
		        "sNext": "下页",
		        "sLast": "末页"
		    },
		    "lengthMenu": "每页 _MENU_ 条记录",
		    "zeroRecords": "没有找到记录",
		    "info": "第 _PAGE_ 页 ( 总共 _PAGES_ 页,  _MAX_ 条记录 )",
		    "infoEmpty": "无记录",
		    "infoFiltered": "(从 _MAX_ 条记录过滤)"
		}
	};
	var selectedClassName='alert-info';
	return {
		getSingleRecord:function(dt){
			var records=dt.rows('.'+selectedClassName).data();
			if(records.length!=1)
			{
				ACEConstant.operateRemind('','请选择一条记录进行操作');
				return;
			}
			return records[0];
		},
		enableRadio:function($table,table,fn){
			$table.on('click','td',function(){
				//选中与不选中
				var $tr=$(this).parent(),
					selected=$tr.hasClass(selectedClassName);
				$('tr',$table).removeClass(selectedClassName);
				!selected&&$tr.addClass(selectedClassName);
				$('input:radio',$tr).prop('checked',!selected);
				table&&fn&&fn(!selected,table.row('.'+selectedClassName).data());
			});
		},
		DEFAULT:DTDefault,
		TITLE:{
			DATETIME:'<i class="icon-time bigger-110 hidden-480"></i>'
		},
		COLUMN: {
			CHECKBOX:{
				className:'center',
				targets: 0,
				width: "47px",
				render: function(data, type, row) {
	                return '<label><input name="selectedId" type="checkbox" class="ace">'+
	                		'<span class="lbl"></span></label>';
	            }
			},
            RADIO: {
				className:'center',
				targets: 0,
				width: "47px",
				render: function(data, type, row) {
	                return '<label><input name="selectedId" type="radio" class="ace">'+
	                		'<span class="lbl"></span></label>';
	            }
			}
        },
        RENDER: {	//常用render可以抽取出来，如日期时间、头像等
            ELLIPSIS:function(len){
            	return function (data, type, row, meta) {
            		data = data||"";
            		var dataText=data;
                	if(dataText.length>len)
                		dataText=data.substr(0,len)+'...';
                	return '<span title="' + data + '">' + dataText + '</span>';
                }
            } 
        }
	};
});